package dto

import (
	"hc-admin/app/admin/models"
	"hc-admin/common/dto"
	common "hc-admin/common/models"
)

type BusPageGetPageReq struct {
	dto.Pagination `search:"-"`
	Lang           string `form:"lang"  search:"type:exact;column:lang;table:bus_page" comment:"1繁体，2简体，3英语"`
	Title          string `form:"title"  search:"type:contains;column:title;table:bus_page" comment:"页面标题"`
	SubTitle       string `form:"subTitle"  search:"type:contains;column:sub_title;table:bus_page" comment:"副标题"`
	PageKey        string `form:"pageKey"  search:"type:exact;column:page_key;table:bus_page" comment:"页面key"`
	BusPageOrder
}

type BusPageOrder struct {
	Id        string `form:"idOrder"  search:"type:order;column:id;table:bus_page"`
	Lang      string `form:"langOrder"  search:"type:order;column:lang;table:bus_page"`
	Title     string `form:"titleOrder"  search:"type:order;column:title;table:bus_page"`
	SubTitle  string `form:"subTitleOrder"  search:"type:order;column:sub_title;table:bus_page"`
	PageKey   string `form:"pageKeyOrder"  search:"type:order;column:page_key;table:bus_page"`
	ThumbImg  string `form:"thumbImgOrder"  search:"type:order;column:thumb_img;table:bus_page"`
	Content   string `form:"contentOrder"  search:"type:order;column:content;table:bus_page"`
	Status    string `form:"statusOrder"  search:"type:order;column:status;table:bus_page"`
	CreateBy  string `form:"createByOrder"  search:"type:order;column:create_by;table:bus_page"`
	UpdateBy  string `form:"updateByOrder"  search:"type:order;column:update_by;table:bus_page"`
	CreatedAt string `form:"createdAtOrder"  search:"type:order;column:created_at;table:bus_page"`
	UpdatedAt string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:bus_page"`
	DeletedAt string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:bus_page"`
}

func (m *BusPageGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type BusPageInsertReq struct {
	Id        int    `json:"-" comment:""` //
	Lang      string `json:"lang" comment:"1繁体，2简体，3英语"`
	Title     string `json:"title" comment:"页面标题"`
	SubTitle  string `json:"subTitle" comment:"副标题"`
	PageKey   string `json:"pageKey" comment:"页面key"`
	OrderSort int    `json:"orderSort" comment:"排序号"`
	ThumbImg  string `json:"thumbImg" comment:"缩略图"`
	Content   string `json:"content" comment:"页面内容"`
	Status    string `json:"status" comment:"状态"`
	common.ControlBy
}

func (s *BusPageInsertReq) Generate(model *models.BusPage) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Lang = s.Lang
	model.Title = s.Title
	model.SubTitle = s.SubTitle
	model.PageKey = s.PageKey
	model.OrderSort = s.OrderSort
	model.ThumbImg = s.ThumbImg
	model.Content = s.Content
	model.Status = s.Status
	model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

func (s *BusPageInsertReq) GetId() interface{} {
	return s.Id
}

type BusPageUpdateReq struct {
	Id        int    `uri:"id" comment:""` //
	Lang      string `json:"lang" comment:"1繁体，2简体，3英语"`
	Title     string `json:"title" comment:"页面标题"`
	SubTitle  string `json:"subTitle" comment:"副标题"`
	PageKey   string `json:"pageKey" comment:"页面key"`
	OrderSort int    `json:"orderSort" comment:"排序号"`
	ThumbImg  string `json:"thumbImg" comment:"缩略图"`
	Content   string `json:"content" comment:"页面内容"`
	Status    string `json:"status" comment:"状态"`
	common.ControlBy
}

func (s *BusPageUpdateReq) Generate(model *models.BusPage) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.Lang = s.Lang
	model.Title = s.Title
	model.SubTitle = s.SubTitle
	model.PageKey = s.PageKey
	model.OrderSort = s.OrderSort
	model.ThumbImg = s.ThumbImg
	model.Content = s.Content
	model.Status = s.Status
	model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

func (s *BusPageUpdateReq) GetId() interface{} {
	return s.Id
}

// BusPageGetReq 功能获取请求参数
type BusPageGetReq struct {
	Id int `uri:"id"`
}

func (s *BusPageGetReq) GetId() interface{} {
	return s.Id
}

// BusPageDeleteReq 功能删除请求参数
type BusPageDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *BusPageDeleteReq) GetId() interface{} {
	return s.Ids
}
